/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package arg.program.database;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;

/**
 *
 * @author Jasmin
 */
public class CreateARGDatabase {
    
   //Constructor
    public CreateARGDatabase()
    {
        CreateARGDB();
    }
    
    
    public void CreateARGDB()
    {
        final String DB_URL = "jdbc:derby:ARGDB;create=true";
        
        try
        {
            // Create a connection to the database.
            Connection conn =
            DriverManager.getConnection(DB_URL);
            
            // Get a Statement object.
            Statement stmt = conn.createStatement();
            System.out.println("Creating DB");
            
            // Create the table.
            stmt.execute("CREATE TABLE AnimeTable (" + 
                    "UNIQ_ID VARCHAR(6) NOT NULL PRIMARY KEY, " +
                    "ENG_TITLE VARCHAR(100), " +
                    "JAP_TITLE VARCHAR(100), " +
                    "SYNOPSIS VARCHAR(800), " +
                    "NUM_EP VARCHAR(3), " +
                    "GENRE VARCHAR(200), " +
                    "COMP VARCHAR(50), " +
                    "PHOTO VARCHAR(50))");

            stmt.close();
            conn.close();
            System.out.println("Created");
        } 
        catch (Exception ex)
        {
            System.out.println("ERROR: " + ex.getMessage());
        }
    }
}
